/**
 * CascaderSelect 级联选择器组件入口文件
 * Vue3 + TypeScript 版本
 */

import CascaderSelect from './CascaderSelect.vue'

// 导出组件
export { CascaderSelect }
export default CascaderSelect

// 导出类型定义
export type {
  CascaderOption,
  CascaderProps,
  CascaderEmits,
  CascaderInstance,
  CascaderConfig,
  CascaderTheme,
  CascaderValuePath,
  CascaderLabelPath,
  CascaderPanels
} from './types/cascader'

// 工具函数
export {
  flattenToCascader,
  findOptionsByPath,
  getLeafOptions
} from './utils/cascader-utils'

// Vue插件安装函数
import type { App } from 'vue'

export const install = (app: App): void => {
  app.component('CascaderSelect', CascaderSelect)
}

// 支持按需导入
export const CascaderSelectPlugin = {
  install
}

// 版本信息
export const version = '2.0.0'

// 默认配置
export const DEFAULT_CONFIG = {
  showHeader: true,
  maxHeight: '450px',
  panelMinWidth: '220px',
  clearable: true,
  disabled: false,
  customClass: ''
}

export const DEFAULT_THEME = {
  primaryColor: '#667eea',
  borderColor: '#e9ecef',
  backgroundColor: '#fff',
  hoverBackgroundColor: '#f8f9fa',
  activeBackgroundColor: '#e7f3ff',
  textColor: '#495057',
  disabledTextColor: '#adb5bd'
}

// 全局安装（可选，用于CDN引入）
if (typeof window !== 'undefined' && window.Vue) {
  window.Vue.createApp({}).use(install)
}
